<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="./css/animate.css">
  <style>
    .box {
      width: 270px;
      height: 50px;
      background-color: rgb(249, 197, 197);
      border-radius: 5px;
      --animate-duration: 1s;
      opacity: 0;
    }

    @keyframes box {
    0%{
        opacity: 0;
    }
    100%{
        opacity: 1;
    }
}


  </style>
</head>
<body>
  <div>
   
    <button onclick="handler(event)">开始</button>
    <div class="box" >Oops,this is a error message. <button onclick="handler1(event)">X</button></div>
  </div>
  
  <script>
    
    const box =document.querySelector('.box');
 
    function handler(event) {
      
      box.classList.add('animate__animated','animate__bounceIn');
    }
function handler1(event) {
      box.classList.remove('animate__animated', 'animate__backOutUp');
    }
 
  </script>
</body>
</html>